<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>登录</title>
		<link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="LayerCss/login.css" />
	<script type="text/javascript" src="js/jquery-3.1.0.min.js" language="javascript"></script>
	<script type="text/javascript" src="js/layer/layer.js"></script><!--表单验证JS-->
  
		<script type="text/javascript"  language="javascript">
				$(function(){
					$("#login").click(function(){
						
						var username=$("#username").val();
						var password=$("#password").val();
						if(username==""||password==""){
							layer.msg('未输入账号或密码', {time: 2000,icon: 5});
						}else{
							var load = layer.load(0,{time:10000});
							$.ajax({
								url:"../tealogin.do",
								type:"post",
								dataType:"json",
			        			data:"username="+username+"&password="+password,
			        			success:function(data){
			        				if(data=="true"){
			        					layer.close(load);
			        					window.location.href="teamain/teamain.html";
			        				}else{
			        					layer.close(load);
			        					layer.msg('登录失败！账号或密码错误', {time: 2000,icon: 2});
			        					$("#password").val("");
			        				}
			        			}
							});
						}
						
					});
					$("#root").click(function(){
						window.location.href="rootlogin.html";
					});
					$("#log").click(function(){
						window.location.href="index.html";
					});
					$("#res").click(function(){
						window.location.href="tch_teacherRegisterUser.html";
					});
				});
		</script>
	
	</head>

	<body class="beg-login-bg">
		<div class="beg-login-box">
			<header>
				<h1>教师登录</h1>
			</header>
			<div class="beg-login-main">
					<div class="layui-form-item">
						<label class="beg-login-icon">
                        <i class="layui-icon">&#xe612;</i>
                    </label>
						<input type="text" name="userName" id="username" lay-verify="userName" autocomplete="off" placeholder="这里输入登录名" class="layui-input">
					</div>
					<div class="layui-form-item">
						<label class="beg-login-icon">
                        <i class="layui-icon">&#xe642;</i>
                    </label>
						<input type="password" name="password" id="password" lay-verify="password" autocomplete="off" placeholder="这里输入密码" class="layui-input">
					</div>
					
					<button class="layui-btn" id="login" style="margin: 0px 15px;padding: 0px 32px;">登录</button>
					<button class="layui-btn layui-btn-danger" id="res" style="margin: 0px 15px;padding: 0px 32px;">注册</button>
				
			</div>
			<footer>
				<p>学弥途远 · 校本课选课系统</p>
			</footer>
		</div>
	
	</body>

</html>